﻿@using admin.Model
@{
    ViewData["Title"] = "Home";
    Layout = "~/Views/Shared/_SubMenuLayout.cshtml";

}


<div class="page-container">
    <p class="f-20 text-success">欢迎登录西安建筑科技大学出版社</p>
    <table class="table table-border table-bordered table-bg">
        <thead>
            <tr>
                <th colspan="7" scope="col">信息统计</th>
            </tr>
            <tr class="text-c">
                <th>统计</th>
                <th>总订单数</th>
                <th>总图书数</th>
                <th>总用户数</th>
                <th>总作家数</th>
                <th>出书申请</th>
                <th>销售统计</th>
            </tr>
        </thead>
        <tbody>
            <tr class="text-c">
                <td>总数</td>
                <td id="order">@ViewData["allorder"]</td>
                <td id="book">@ViewData["allbook"]</td>
                <td id="user">@ViewData["allcustomer"]</td>
                <td id="author">@ViewData["allauthor"]</td>
                <td id="article">@ViewData["allarticle"]</td>
                <td id="salecount">@ViewData["allsalecount"]</td>
            </tr>
            <tr class="text-c">
                <td>今日</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
            </tr>
            <tr class="text-c">
                <td>昨日</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
            </tr>
            <tr class="text-c">
                <td>本周</td>
                <td>2</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
            </tr>
            <tr class="text-c">
                <td>本月</td>
                <td>2</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
                <td>0</td>
            </tr>
        </tbody>
    </table>
    <div id="container" style="min-width:700px;height:400px"></div>
</div>

@section Scripts{
    <script src="~/lib/jquery/1.9.1/jquery.js"></script>
    <script type="text/javascript" src="~/echarts/echarts.min.js"></script>
    <script type="text/javascript">
        var dom = document.getElementById("container");
        var order = $("#order").text();
        var book = $("#book").text();
        var user = $("#user").text();
        var author = $("#author").text();
        var article = $("#article").text();
        var myChart = echarts.init(dom);
        var app = {};
        option = null;
        app.title = '环形图';

        option = {
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b}: {c} ({d}%)"
            },
            legend: {
                orient: 'vertical',
                x: 'left',
                data: ['总订单数', '总图书数', '总用户数', '总作家数', '出书申请']
            },
            series: [
                {
                    name: '访问来源',
                    type: 'pie',
                    radius: ['50%', '70%'],
                    avoidLabelOverlap: false,
                    label: {
                        normal: {
                            show: false,
                            position: 'center'
                        },
                        emphasis: {
                            show: true,
                            textStyle: {
                                fontSize: '30',
                                fontWeight: 'bold'
                            }
                        }
                    },
                    labelLine: {
                        normal: {
                            show: false
                        }
                    },
                    data: [
                        { value: order, name: '总订单数' },
                        { value: book, name: '总图书数' },
                        { value: user, name: '总用户数' },
                        { value: author, name: '总作家数' },
                        { value: article, name: '出书申请' },
                    ]
                }
            ]
        };
        ;
        if (option && typeof option === "object") {
            myChart.setOption(option, true);
        }
    </script>
}